<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../css/reset.css">
    <link rel="stylesheet" href="../css/banner.css">
</head>
<body>

    <h1>首页</h1>
    <h2>
        <a href="./13_list.html">商品列表</a>
    </h2>

    <div class="top">
        <div class="login">欢迎XX   <span>退出登陆</span></div>
        <div class="noLogin">
            <a href="">登陆</a>
            <a href="">注册</a>
        </div>
    
    </div>


    <!-- 无缝轮播 -->
    <!-- 透明度轮播 -->
    <div class="banner" id="b1">
        <ul>
            <!-- <li class="show"></li> -->
        </ul>
        <ol>
            <!-- <li class="active"></li> -->
        </ol>
        <span class="prev"></span>
        <span class="next"></span>
    </div>



    <script src="../js/ajax.js"></script>
    <script src="../js/banner_v2.js"></script>
    <script>

        // 判断用户是否登陆
        //    去localStorage去找

        // 退出登陆   --- 移除localStorage
        const user = localStorage.getItem('USER_LOGIN');
        if(user) {
            console.log('登陆ok');
            // 显示  login
        } else {
            console.log('没有登陆')
            // 显示 noLogin
        }


       

        // 轮播图
        ajax({
            type : 'get' ,
            path : 'http://192.168.58.110/php/banner.php' ,
            success : res => {
                
                res = JSON.parse(res);
                console.log(res);
                const {status , data} = res ;
                if(status) {

                    // 新的数组  ['' , '']
                    const arr = [] ;
                    data.forEach(item => {
                        // console.log(item.picSrc) ;
                        arr.push(item.picSrc) ;
                    })
                    banner(arr , '#b1') ;
                }
                
            }
        })




        


        // 




    </script>
    
</body>
</html>